﻿using System;
using System.Collections.Generic;

namespace IOA.MES.DataAccess.VModel
{
    /// <summary>
    /// 出库任务
    /// </summary>
    public class VOutbound : BaseVModel
    {
        private string _outboundTypeNo = string.Empty;
        private string _outboundNo = string.Empty;
        private string _warehouseCode = string.Empty;
        private string _warehouseName = string.Empty;
        private string _cabinetNo = string.Empty;
        private string _cnOutboundBy = string.Empty;

        #region Public Property

        ///<Summary>
        /// 出库类型
        ///</Summary>
        public Enum.OutboundType OutboundType { get; set; }

        ///<Summary>
        /// 出库类型ID
        ///</Summary>
        public int OutboundTypeId { get; set; }

        ///<Summary>
        /// 出库类型号
        ///</Summary>
        public string OutboundTypeNo
        {
            get { return string.IsNullOrWhiteSpace(_outboundTypeNo) ? string.Empty : _outboundTypeNo; }
            set { _outboundTypeNo = value; }
        }

        ///<Summary>
        /// 出库单号
        ///</Summary>
        public string OutboundNo
        {
            get { return string.IsNullOrWhiteSpace(_outboundNo) ? string.Empty : _outboundNo; }
            set { _outboundNo = value; }
        }

        ///<Summary>
        /// 柜号
        ///</Summary>
        public string CabinetNo
        {
            get { return string.IsNullOrWhiteSpace(_cabinetNo) ? string.Empty : _cabinetNo; }
            set { _cabinetNo = value; }
        }

        ///<Summary>
        /// 仓库代码
        ///</Summary>
        public string WarehouseCode
        {
            get { return string.IsNullOrWhiteSpace(_warehouseCode) ? string.Empty : _warehouseCode; }
            set { _warehouseCode = value; }
        }

        ///<Summary>
        /// 仓库名称
        ///</Summary>
        public string WarehouseName
        {
            get { return string.IsNullOrWhiteSpace(_warehouseName) ? string.Empty : _warehouseName; }
            set { _warehouseName = value; }
        }

        ///<Summary>
        /// 出库数量
        ///</Summary>
        public decimal Quantity { get; set; }

        ///<Summary>
        /// 已出库数量
        ///</Summary>
        public decimal OutboundedQuantity { get; set; }

        ///<Summary>
        /// 状态
        ///</Summary>
        public Enum.OutboundStatus Status { get; set; }

        ///<Summary>
        /// 状态
        ///</Summary>
        public string CNStatus
        {
            get { return !System.Enum.IsDefined(typeof(Enum.OutboundStatus), Status) ? string.Empty : EnumConvert.ToDesc(Status); }
        }

        ///<Summary>
        /// 出库人
        ///</Summary>
        public int OutboundBy { get; set; }

        /// <summary>
        /// 出库人
        /// </summary>
        public string CNOutboundBy
        {
            get { return string.IsNullOrWhiteSpace(_cnOutboundBy) ? string.Empty : _cnOutboundBy; }
            set { _cnOutboundBy = value; }
        }

        ///<Summary>
        /// 出库时间
        ///</Summary>
        public DateTime? OutboundTime { get; set; }
        #endregion

        public string OutboundTimeStr { get { return OutboundTime?.ToString("yyyy-MM-dd HH:mm:ss") ?? string.Empty; } }

        ///<Summary>
        /// 出库列表
        ///</Summary>
        public List<VOutboundPack> Products { get; set; } = new List<VOutboundPack>();

        ///<Summary>
        /// 包装列表
        ///</Summary>
        public List<VPack> Packs { get; set; } = new List<VPack>();
    }
}
